<script type="text/javascript">
    function doRegister() {
        document.getElementById("registration").todo.value = "doregister";

        if(document.getElementById("username").value=="")
        {
            alert("User name cannot be empty!");
            return false;
        }
        else if(document.getElementById("password").value=="")
        {
            alert("Password cannot be empty!");
            return false;
        }
        else if(document.getElementById("password").value!=document.getElementById("password2").value)
        {
            alert("Two password must be same!");
            return false;
        }
        return true;
    }
</script>
<h1>Register</h1>

<form name="registration" id="registration" method="post" onsubmit="return doRegister()" action="/assignmentCinema/">
    <input type="hidden" id="todo" name ="todo" value=""/>
    <table>
        <tbody>
            <tr>
                <td>User name:</td>
                <td><input type="text" id="username" name="username" /></td>
            </tr>
            <tr>
                <td>Password:</td>
                <td><input type="password" id="password" name="password" /></td>
            </tr>
            <tr>
                <td>Re-enter Password:</td>
                <td><input type="password" id="password2" name="password2" /><label > Must be same as previous</label></td>
            </tr>

        </tbody>

    </table>

    <input type="submit" value="Register"/>
</form>